<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<body>
	<h:form id="frm_groups">
		<p:panel header="User List">
			<p:dataTable value="#{userBean.userList}" var="user" paginator="true"
				rows="25">
				<p:column headerText="#{msgs.Administration_User_FirstName}" sortBy="#{user.firstName}"
					filterBy="#{user.firstName}" filterMatchMode="contains"
					style="width:auto">
					<h:outputText value="#{user.firstName}" />
				</p:column>
				<p:column headerText="#{msgs.Administration_User_SecondName}" sortBy="#{user.secondName}"
					filterBy="#{user.secondName}" filterMatchMode="contains"
					style="width:auto">
					<h:outputText value="#{user.secondName}" />
				</p:column>
				<p:column headerText="#{msgs.Administration_User_Email}" sortBy="#{user.email}"
					filterBy="#{user.email}" filterMatchMode="contains"
					style="width: auto">
					<h:outputText value="#{user.email}" />
				</p:column>
				<p:column headerText="#{msgs.Administration_User_Mobile}" sortBy="#{user.mobile}"
					filterBy="#{user.mobile}" filterMatchMode="contains"
					style="width:auto">
					<h:outputText value="#{user.mobile}" />
				</p:column>
				<p:column headerText="#{msgs.Administration_User_Group}" sortBy="#{user.groupId}"
					filterBy="#{user.groupId}" filterMatchMode="exact"
					filterOptions="#{userBean.groupFilter}" style="width:auto">
					<p:selectOneMenu value="#{user.groupId}" style="font:small;"
						required="true" disabled="true">
						<f:selectItem itemValue="" itemLabel="" />
						<f:selectItems value="#{userBean.groupsList}" var="group"
							itemLabel="#{group.name}" itemValue="#{group.recid}" />
					</p:selectOneMenu>
				</p:column>
				<p:column headerText="#{msgs.Administration_General_Options}"
					style="font-size: smaller;text-align: center;width:auto">

					<p:commandButton action="#{userBean.toEditUser}"
						onstart="waiteDialog.show();" style="width: 30px;height: 30px"
						image="ui-icon ui-icon-pencil" title="Edit">
						<f:setPropertyActionListener value="#{user}"
							target="#{userBean.user}" />
					</p:commandButton>
					<p:spacer width="20" />

					<p:commandButton action="#{userBean.deleteUser}" ajax="true"
						onstart="waiteDialog.show();" oncomplete="waiteDialog.hide();"
						update="@form" style="width: 30px;height: 30px"
						image="ui-icon ui-icon-trash" title="Delete">
						<f:setPropertyActionListener value="#{user}"
							target="#{userBean.user}" />
					</p:commandButton>

				</p:column>

			</p:dataTable>
			<p:messages id="msgs" showDetail="true" showSummary="true" />
		</p:panel>
	</h:form>
</body>
</html>
